//Synthesizers ( // sine wave osc SynthDef("sine", { arg freq, db; var osc; osc = SinOsc.ar(freq, 0, db).dup; Out.ar(0, osc); }).send(s); //WhiteNoise SynthDef("whitenoise", {arg db; var noise; noise = WhiteNoise.ar(db).dup; Out.ar(0, noise); }).send(s); //LPF SynthDef("whitenoiselpf", {arg freq=20000; var lpf, in; in = WhiteNoise.ar([0.1,0.1]); lpf = LPF.ar(in, freq, 1); ReplaceOut.ar(0, lpf); }).send(s); //HPF SynthDef("whitenoisehpf", {arg freq=30; var hpf, in; in = WhiteNoise.ar([0.1,0.1]); hpf = HPF.ar(in, freq, 1); ReplaceOut.ar(0, hpf); }).send(s); ) "Now, let's have exam".speak "xian zai cow she".speak "Section 1, sine wave".speak "Please estimate the frequency".speak "question 1".speak "choose the answer, from 100hz, 440hz, 1000hz, 5000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(100.post, 0.0, 0.1).dup }.play; "question 2".speak "choose the answer, from 100hz, 440hz, 1000hz, 5000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(440.post, 0.0, 0.1).dup }.play; "question 3".speak "choose the answer, from 100hz, 440hz, 1000hz, 5000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(1000.post, 0.0, 0.1).dup }.play; "question 4".speak "choose the answer, from 100hz, 500hz, 1000hz, 5000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(5000.post, 0.0, 0.1).dup }.play; "question 5".speak "choose the answer, from 100hz, 200hz, 500hz, 1000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(100.post, 0.0, 0.1).dup }.play; "question 6".speak "choose the answer, from 100hz, 200hz, 500hz, 1000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(200.post, 0.0, 0.1).dup }.play; "question 7".speak "choose the answer, from 500hz, 1000hz, 5000hz, 8000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(500.post, 0.0, 0.1).dup }.play; "question 8".speak "choose the answer, from 440hz, 880hz, 1760hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(880.post, 0.0, 0.1).dup }.play; "question 9".speak "choose the answer, from 100hz, 200hz, 300hz, 500hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(300.post, 0.0, 0.1).dup }.play; "question 10".speak "choose the answer, from 1000hz, 2000hz, 3000hz, 5000hz".speak " Hz is the Frequency of"+{ FSinOsc.ar(2000.post, 0.0, 0.1).dup }.play; "the end of Section 1".speak "section 2, sine wave".speak "please estimate the sound pressure level change".speak "question 11".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -18.dbamp); s.sendMsg("/n_free", x);"-6dB difference".postln; "question 12".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -24.dbamp); s.sendMsg("/n_free", x);"-12dB difference".postln; "question 13".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -6.dbamp); s.sendMsg("/n_free", x);"+6dB difference".postln; "question 14".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -9.dbamp); s.sendMsg("/n_free", x);"+3dB difference".postln; "question 15".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -15.dbamp); s.sendMsg("/n_free", x);"-3dB difference".postln; "question 16".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", 0.dbamp); s.sendMsg("/n_free", x);"+12dB difference".postln; "question 17".speak "choose the answer, from 0 db difference, 3 db difference, 6 db difference, 12 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -12.dbamp); s.sendMsg("/n_free", x);"0dB difference".postln; "question 18".speak "choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -36.dbamp); s.sendMsg("/n_free", x);"-24dB difference".postln; "question 19".speak "choose the answer, from 1.5 db difference, 3 db difference, 6 db difference, 12 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -10.5.dbamp); s.sendMsg("/n_free", x);"+1.5dB difference".postln; "question 20".speak "choose the answer, from 1.5 db difference, 3 db difference, 6 db difference, 12 db difference".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -13.5.dbamp); s.sendMsg("/n_free", x);"-1.5dB difference".postln; "the end of Section 2".speak "section 3 sine wave".speak "please estimate the frequency and sound pressure level change".speak "question 21".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,5000.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -6.dbamp); s.sendMsg("/n_free", x);"+6dB difference".postln; "question 22".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -6.dbamp); s.sendMsg("/n_free", x);"+6dB difference".postln; "question 23".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,440.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -18.dbamp); s.sendMsg("/n_free", x);"-6dB difference".postln; "question 24".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,100.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -18.dbamp); s.sendMsg("/n_free", x);"-6dB difference".postln; "question 25".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,100.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -24.dbamp); s.sendMsg("/n_free", x);"-12dB difference".postln; "question 26".speak s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,440.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -6.dbamp); s.sendMsg("/n_free", x);"+6dB difference".postln; "question 27".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -18.dbamp); s.sendMsg("/n_free", x);"-6dB difference".postln; "question 28".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,5000.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -18.dbamp); s.sendMsg("/n_free", x);"-6dB difference".postln; "question 29".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,1000.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -9.dbamp); s.sendMsg("/n_free", x);"+3dB difference".postln; "question 30".speak " Hz"+s.sendMsg("/s_new", "sine", x = s.nextNodeID, 1, 1, \freq,100.post, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -9.dbamp); s.sendMsg("/n_free", x);"+3dB difference".postln; "the end of Section 3".speak "section 4, noise".speak "please choose the answer, from 3 db difference, 6 db difference, 12 db difference, 24 db difference".speak "question 31".speak s.sendMsg("/s_new", "whitenoise", x = s.nextNodeID, 1, 1, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -24.dbamp); s.sendMsg("/n_free", x);"-12dB difference".postln; "question 32".speak s.sendMsg("/s_new", "whitenoise", x = s.nextNodeID, 1, 1, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -6.dbamp); s.sendMsg("/n_free", x);"+6dB difference".postln; "question 33".speak s.sendMsg("/s_new", "whitenoise", x = s.nextNodeID, 1, 1, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -36.dbamp); s.sendMsg("/n_free", x);"-24dB difference".postln; "question 34".speak s.sendMsg("/s_new", "whitenoise", x = s.nextNodeID, 1, 1, \db,-12.dbamp); s.sendMsg("/n_set", x, "db", -9.dbamp); s.sendMsg("/n_free", x);"+3dB difference".postln; "the end of section 4".speak "section 5, noise".speak "please estimate the cutoff frequency for this Low pass filter".speak "question 35".speak "choose the answer, from 200hz, 1000hz, 2000hz ,5000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 5000.post); s.sendMsg("/n_free", l); "question 36".speak "choose the answer, from 200hz, 1000hz, 2000hz ,5000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 200.post); s.sendMsg("/n_free", l); "question 37".speak "choose the answer, from 200hz, 1000hz, 4000hz ,5000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 1000.post); s.sendMsg("/n_free", l); "question 38".speak "choose the answer, from 200hz, 1000hz, 2000hz ,5000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 2000.post); s.sendMsg("/n_free", l); "question 39".speak "choose the answer, from 1000hz, 2000hz, 3000hz ,5000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 5000.post); s.sendMsg("/n_free", l); "question 40".speak "choose the answer, from 1000hz, 2000hz, 3000hz ,6000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 6000.post); s.sendMsg("/n_free", l); "question 41".speak "choose the answer, from 1000hz, 2000hz, 6000hz ,7000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 1000.post); s.sendMsg("/n_free", l); "question 42".speak "choose the answer, from 1000hz, 2000hz, 3000hz, 4000hz".speak s.sendMsg("/s_new", "whitenoiselpf", l = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", l, "freq", 2000.post); s.sendMsg("/n_free", l); "the end of Section 5".speak "section 6, noise".speak "please estimate the cutoff frequency for this high pass filter".speak "question 43".speak "choose the answer, from 200hz, 1000hz, 2000hz, 5000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 5000.post); s.sendMsg("/n_free", h); "question 44".speak "choose the answer, from 200hz, 1000hz, 2000hz, 5000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 200.post); s.sendMsg("/n_free", h); "question 45".speak "choose the answer, from 200hz, 1000hz, 4000hz, 5000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 1000.post); s.sendMsg("/n_free", h); "question 46".speak "choose the answer, from 200hz, 1000hz, 2000hz, 5000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 2000.post); s.sendMsg("/n_free", h); "question 47".speak "choose the answer, from 200hz, 500hz, 4000hz, 5000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 500.post); s.sendMsg("/n_free", h); "question 48".speak "choose the answer, from 100hz, 500hz, 1000hz, 2000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 100.post); s.sendMsg("/n_free", h); "question 49".speak "choose the answer, from 100hz, 200hz, 300hz, 400hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 200.post); s.sendMsg("/n_free", h); "question 50".speak "choose the answer, from 1000hz, 2000hz, 3000hz, 4000hz".speak s.sendMsg("/s_new", "whitenoisehpf", h = s.nextNodeID,1,1); " Hz is the cutoff Frequency"+s.sendMsg("/n_set", h, "freq", 2000.post); s.sendMsg("/n_free", h); "the end of Section 6".speak "the end of the exam".speak "thank you".speak